<template>
	<view>
		<component :is="isShowIndex" ref="myChildComponentOne"></component>
		<!-- <tab-bar-view :tabCode="'1'"></tab-bar-view> -->
	</view>
</template>

<script>
	import satetyThreeBuildOneFloor from "@/components/dormThreeBuildingOneFloor/satety/index.vue"
	import satetyThreeBuildTwoFloor from "@/components/dormThreeBuildingTwoFloor/satety/index.vue"
	import satetyThreeBuildThreeFloor from "@/components/dormThreeBuildingThreeFloor/satety/index.vue"
	import satetyThreeBuildFourFloor from "@/components/dormThreeBuildingFourFloor/satety/index.vue"
	import satetyThreeBuildFiveFloor from "@/components/dormThreeBuildingFiveFloor/satety/index.vue"

	import satetyTwoBuildOneFloor from "@/components/dormTwoBuildingOneFloor/satety/index.vue"
	import satetyTwoBuildTwoFloor from "@/components/dormTwoBuildingTwoFloor/satety/index.vue"
	import satetyTwoBuildThreeFloor from "@/components/dormTwoBuildingThreeFloor/satety/index.vue"
	import satetyTwoBuildFourFloor from "@/components/dormTwoBuildingFourFloor/satety/index.vue"
	import satetyTwoBuildFiveFloor from "@/components/dormTwoBuildingFiveFloor/satety/index.vue"

	import satetyOneBuildOneFloor from "@/components/dormOneBuildingOneFloor/satety/index.vue"
	import satetyOneBuildTwoFloor from "@/components/dormOneBuildingTwoFloor/satety/index.vue"
	import satetyOneBuildThreeFloor from "@/components/dormOneBuildingThreeFloor/satety/index.vue"
	import satetyOneBuildFourFloor from "@/components/dormOneBuildingFourFloor/satety/index.vue"
	import satetyOneBuildFiveFloor from "@/components/dormOneBuildingFiveFloor/satety/index.vue"

	import safetyEleOrHeader from "@/components/electricianOneBuild/safety/index.vue"
	export default {
		components: {
			satetyThreeBuildOneFloor,
			satetyThreeBuildTwoFloor,
			satetyThreeBuildThreeFloor,
			satetyThreeBuildFourFloor,
			satetyThreeBuildFiveFloor,
			satetyTwoBuildOneFloor,
			satetyTwoBuildTwoFloor,
			satetyTwoBuildThreeFloor,
			satetyTwoBuildFourFloor,
			satetyTwoBuildFiveFloor,
			satetyOneBuildOneFloor,
			satetyOneBuildTwoFloor,
			satetyOneBuildThreeFloor,
			satetyOneBuildFourFloor,
			satetyOneBuildFiveFloor,
			safetyEleOrHeader
		},
		data() {
			return {
				activeMenu: "",
				isShowIndex: "",
			};
		},
		onLoad(query) {
			this.activeMenu = query.activeMenu
		},
		onShow() {
			this.switchShowPage(this.activeMenu)
			this.$refs.myChildComponentOne.setupTimer();
		},
		onReady() {
			// 隐藏导航栏
			uni.hideTabBar({});
		},
		onUnload() {
			this.$refs.myChildComponentOne.clearTimer();
		},
		methods: {
			switchShowPage(data) {
				const _this = this
				switch (data) {
					case '3-1':
						_this.isShowIndex = 'satetyThreeBuildOneFloor'
						break;
					case '3-2':
						_this.isShowIndex = 'satetyThreeBuildTwoFloor'
						break;
					case '3-3':
						_this.isShowIndex = 'satetyThreeBuildThreeFloor'
						break;
					case '3-4':
						_this.isShowIndex = 'satetyThreeBuildFourFloor'
						break;
					case '3-5':
						_this.isShowIndex = 'satetyThreeBuildFiveFloor'
						break;
					case '2-1':
						_this.isShowIndex = 'satetyTwoBuildOneFloor'
						break;
					case '2-2':
						_this.isShowIndex = 'satetyTwoBuildTwoFloor'
						break;
					case '2-3':
						_this.isShowIndex = 'satetyTwoBuildThreeFloor'
						break;
					case '2-4':
						_this.isShowIndex = 'satetyTwoBuildFourFloor'
						break;
					case '2-5':
						_this.isShowIndex = 'satetyTwoBuildFiveFloor'
						break;
					case '1-1':
						_this.isShowIndex = 'satetyOneBuildOneFloor'
						break;
					case '1-2':
						_this.isShowIndex = 'satetyOneBuildTwoFloor'
						break;
					case '1-3':
						_this.isShowIndex = 'satetyOneBuildThreeFloor'
						break;
					case '1-4':
						_this.isShowIndex = 'satetyOneBuildFourFloor'
						break;
					case '1-5':
						_this.isShowIndex = 'satetyOneBuildFiveFloor'
						break;
					case 'dg':
						_this.isShowIndex = 'safetyEleOrHeader'
						break;
					case 'xz':
						_this.isShowIndex = 'safetyEleOrHeader'
						break;
					default:
						// 如果 expression 不匹配任何 case 值，则执行 default 子句中的代码块  
						break;
				}
			},

			goPage(url) {
				uni.navigateTo({
					url
				});
			},
		},
	};
</script>

<style lang="scss" scoped>
	page {
		background-color: #f5f5f5;
	}
</style>